<template>
    <el-input-number 
        v-model="value" 
        :disabled="disabled"
        @change="Change('change')"
        @input="Change('change')"
        :style="domCss" 
        :min="min" 
        :max="max">
    </el-input-number>
</template>

<script>
export default {
    props:{
        label: {
            type: String,
            default: ''
        },
        disabled: {
            type: Boolean,
            default: false
        },
        domCss: {
            type: String,
            default: ''
        },
        min: {
            type: Number,
            default: 0
        },
        max: {
            type: Number,
            default: 10000
        },
        defaultValue: {
            type: Number,
            default: 0
        }
    },
    data() {
        return {
            value: 0,
        }
    },
    watch: {
        defaultValue: {
            deep: true,
            immediate: true,
            handler: function(v) {
                this.value = v || 0
            }
        }
    },
    created() {
        this.value = this.defaultValue == ''?0:this.defaultValue;
    },
    methods: {
        Change(type){
            this.$emit('EventHandler',type, this.$attrs.prop,this.value);
        },
    },
}
</script>

<style lang="scss" scoped>

</style>